﻿// <copyright file="UpdateResultTests.cs" company="Mooville">
//   Copyright © 2010 Roger Deetz. All rights reserved.
// </copyright>

namespace Mooville.Common.Updates.Tests
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Mooville.Common.Testing.Mocks;
    using Mooville.Common.Updates;

    [TestClass]
    public class UpdateResultTests
    {
        [TestMethod]
        public void Constructor_ShouldNotThrow()
        {
            UpdateResult target = new UpdateResult();
            Assert.IsNotNull(target);

            return;
        }

        [TestMethod]
        public void AfterConstructor_ResultType_ShouldBeNoUpdateAvailable()
        {
            UpdateResult target = new UpdateResult();
            Assert.AreEqual(UpdateResultType.NoUpdateAvailable, target.ResultType);

            return;
        }

        [TestMethod]
        public void AfterConstructor_Address_ShouldBeNull()
        {
            UpdateResult target = new UpdateResult();
            Assert.IsNull(target.Address);

            return;
        }

        [TestMethod]
        public void AfterConstructor_Exception_ShouldBeNull()
        {
            UpdateResult target = new UpdateResult();
            Assert.IsNull(target.Exception);

            return;
        }

        [TestMethod]
        public void ResultType_ShouldAcceptValue()
        {
            UpdateResult target = new UpdateResult();
            target.ResultType = UpdateResultType.UpdateAvailable;
            Assert.AreEqual(UpdateResultType.UpdateAvailable, target.ResultType);

            return;
        }

        [TestMethod]
        public void Address_ShouldAcceptValue()
        {
            UpdateResult target = new UpdateResult();
            target.Address = TestUpdateService.DefaultTestAddress;
            Assert.AreEqual(TestUpdateService.DefaultTestAddress, target.Address);

            return;
        }

        [TestMethod]
        public void Exception_ShouldAcceptValue()
        {
            UpdateResult target = new UpdateResult();
            InvalidOperationException ioe = new InvalidOperationException();
            target.Exception = ioe;
            Assert.AreEqual(ioe, target.Exception);

            return;
        }
    }
}
